<?php 
	if (isset($errno))
		echo "<p>DB Error: ($errno) $errmsg</p>";

	if(isset($tickets) && count($tickets) > 0) {
		echo "<h4>Tickets sold</h4>";
		echo "<table>";
		echo "<tr><th>Ticket #</th><th>Title</th><th>Theater</th><th>Seat</th>
					<th>First Name</th><th>Last Name</th>
					<th>Credit card #</th><th>Expiration Date</th></tr>";
		
		foreach ($tickets as $ticket) {
			echo "<tr>";
			echo "<td>" . $ticket->ticket . "</td>";
			echo "<td>" . $ticket->title . "</td>";
			echo "<td>" . $ticket->name . "</td>";
			echo "<td>" . $ticket->seat . "</td>";
			echo "<td>" . $ticket->first . "</td>";
			echo "<td>" . $ticket->last . "</td>";
			echo "<td>" . $ticket->creditcardnumber . "</td>";
			echo "<td>" . $ticket->creditcardexpiration . "</td>";	
			echo "</tr>";
		}
		echo "</table>";
	} else {
		echo "No tickets were sold yet";
	} 
?>